<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMemberAccountsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('member_accounts', function (Blueprint $table) {
            $table->id();
            $table->integer('member_id')->default(0)->comment('会员ID');
            $table->integer('balance')->default(0)->comment('余额');
            $table->integer('coin')->default(0)->comment('金币');
            $table->tinyInteger('status')->default(0)->comment('账户状态 详情见模型');
            $table->timestamps();
            $table->index('member_id');
        });
        DB::statement("ALTER TABLE `member_accounts` comment '会员账户表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('member_accounts');
    }
}
